#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int w[N];
int n, k, q;
int main()
{
    scanf("%d%d", &n, &q);
    for (int i = 0; i < n; i++)
        scanf("%d", &w[i]);
    while (q--)
    {
        scanf("%d", &k);
        int le, re;
        int l = 0, r = n - 1;
        while (l < r)
        {
            int mid = l + r >> 1;
            if (w[mid] >= k) r = mid;
            else l = mid + 1;
        }
        le = l;
        l = 0, r = n - 1;
        while (l < r)
        {
            int mid = l + r >> 1 + 1;
            if (w[mid] <= k) l = mid;
            else r = mid - 1;
        }
        re = r;
        if (w[r] == k)
            cout << le << ' ' << re << endl;
        else
            cout << -1 << ' ' << -1 << endl;
    }
    return 0;
}